//Brian Goodacre
package data;
import hilbert.*;
import settings.Global;

public class DataPoint implements Comparable<DataPoint>{
	//public values
	public final static int size_bytes = 3*Global.int_bytes;
	
	//constructor values
	private long hilbert_value; //key
	private int x_point; //data
	private int y_point; //data
	
	//this constructor holds an x and y value
	public DataPoint(int x_point, int y_point) {
		super();
		this.x_point = x_point;
		this.y_point = y_point;
		hilbert_value = Hilbert.getHilbertValue(x_point,y_point);
	}
	
	//getters, no need for setters
	public int getX_point() {return x_point;}
	public int getY_point() {return y_point;}
	public long getHilbert_value() {return hilbert_value;}

	//compare to using java for Collections.sort()
	public int compareTo(DataPoint dp){
		//easy to use values
		long h1 = this.hilbert_value;
		long h2 = dp.getHilbert_value();
		
		//comparisons
		if(h1==h2)
			return 0;
		else if(h1<h2)
			return -1;
		else //h1>h2
			return 1;
	}
}
